import noticeApi from '@/api/declaration/noticeApi'
import httpRequest from '@/config/axios/httpRequest'
import {
  CreateNoticeReq,
  CreateNoticeResp,
  DeleteNoticeReq,
  DeleteNoticeResp,
  PushNoticeReq,
  PushNoticeResp,
  QueryNoticeDetailReq,
  QueryNoticeDetailResp,
  QueryNoticePageReq,
  QueryNoticePageResp,
  UpdateNoticeReq,
  UpdateNoticeResp
} from '@/models/system/NoticeModel'

// 查询公告列表
export const getNoticePage = async (params: QueryNoticePageReq) => {
  return await httpRequest.get<QueryNoticePageResp>(noticeApi.QueryNoticePage, { params })
}

// 查询公告详情
export const getNotice = async (params: QueryNoticeDetailReq) => {
  return await httpRequest.get<QueryNoticeDetailResp>(noticeApi.QueryNotice, { params })
}

// 新增公告
export const createNotice = async (data: CreateNoticeReq) => {
  return await httpRequest.post<CreateNoticeResp>(noticeApi.CreateNotice, data)
}

// 修改公告
export const updateNotice = async (data: UpdateNoticeReq) => {
  return await httpRequest.put<UpdateNoticeResp>(noticeApi.UpdateNotice, data)
}

// 删除公告
export const deleteNotice = async (params: DeleteNoticeReq) => {
  return await httpRequest.delete<DeleteNoticeResp>(noticeApi.DeleteNotice, { params })
}

// 推送公告
export const pushNotice = async (params: PushNoticeReq) => {
  return await httpRequest.post<PushNoticeResp>(noticeApi.PushNotice, params)
}
